import {ref, computed, watchEffect, h, reactive, defineComponent} from "vue";

const hello = {
  props: ['attrs'],
  setup({ attrs }) {
    // 对应模块1
    let count = ref(0)
    // 对应模块1结束
    return () => {
      // const children = []
      //
      // let bala = 456
      //
      // const temp1 = h('p', {}, attrs.title)
      // children.push(temp1)
      //
      // const temp2 = h('p', {}, count.value)
      // children.push(temp2)
      //
      // children.push(slots.default())
      //
      // children.push(bala)
      return attrs.title
    }
  }
}

export default {
  setup() {
    const count = ref(14);

    const autoIncrement = () => {
      const interval = setInterval(() => {
        count.value += 1;
        console.log('当前计数:', count.value);
      }, 1000);
      return () => clearInterval(interval);
    };

    autoIncrement();

    return () => {
      // 使用 IIFE 包装的表达式
      const hv = (() => {
        const count222 = 14
        return h('div', {}, count222)
      })()
      const hv1 = h('div', {}, count.value + 1)

      const helloVNode = h(hello, {attrs: {title: hv1}});

      const cc = []
      cc.push(hv1)
      cc.push(hv)
      cc.push(helloVNode)
      return cc
    }
  }
}